package com.bdqn.design;

import com.bdqn.design.proxy.jdk.TransactionJDKProxyFactory;
import com.bdqn.reflect.pojo.Person;
import com.bdqn.reflect.service.PersonService;
import com.bdqn.reflect.service.impl.PersonServiceImpl;

/**
 * Test06ProxyDynamicJDK 动态代理（使用JDK实现动态代理）
 *
 * @author LILIBO
 * @since 2023-10-10
 */
public class Test06ProxyDynamicJDK {

    public static void main(String[] args) {
        Person from = new Person("曹源", 5000, "", "湖南郴州");
        Person to = new Person("袁嗣善", 200, "", "湖南郴州");
        // 使用JDK实现动态代理
        PersonService personService = TransactionJDKProxyFactory.create(new PersonServiceImpl());
        boolean result = personService.transfer(from, to, 5000);
        System.out.println("[返回结果]：" + result);
        System.out.println(from);
        System.out.println(to);

    }

}
